// HyperEdit.cpp : Implementation file
//

#include "stdafx.h"
#include "MyUI.h"
#include "HyperEdit.h"


// CHyperEdit

IMPLEMENT_DYNAMIC(CHyperEdit, CEdit)

CHyperEdit::CHyperEdit()
{

}

CHyperEdit::~CHyperEdit()
{
}


BEGIN_MESSAGE_MAP(CHyperEdit, CEdit)
	ON_WM_LBUTTONDBLCLK()
	ON_WM_LBUTTONDOWN()
END_MESSAGE_MAP()



// CHyperEdit Message handler

void CHyperEdit::SetURL(CString strURL)
{
	m_strURL = strURL;
}

CString CHyperEdit::GetURL() const
{
	return m_strURL;
}


int CHyperEdit::GotoURL(LPCTSTR url, int showcmd)
{
	HINSTANCE result = ShellExecute(NULL, _T("open"), url, NULL, NULL, showcmd);
	return (int)result;
}




void CHyperEdit::OnLButtonDblClk(UINT nFlags, CPoint point)
{
	// TODO: Add message handler code and/or invoke default values here
	if (m_strURL.IsEmpty())
	{
		GetWindowText(m_strURL);
	}
	GotoURL(m_strURL, SW_SHOW);
	CEdit::OnLButtonDblClk(nFlags, point);
}


void CHyperEdit::OnLButtonDown(UINT nFlags, CPoint point)
{
	// TODO: Add message handler code and/or invoke default values here
	CEdit::OnLButtonDown(nFlags, point);
}



